2 require_once('modules/Emails/Email.php');
4 class Bug40527Test extends Sugar_PHPUnit_Framework_TestCase
10 public function setUp()
12 $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
13 $this->contact = SugarTestContactUtilities::createContact();
14 $this->account = SugarTestAccountUtilities::createAccount();
16 $override_data = array(
17 'parent_type' => 'Accounts',
18 'parent_id' => $this->account->id,
20 $this->email = SugarTestEmailUtilities::createEmail('', $override_data);
23 public function tearDown()
25 SugarTestContactUtilities::removeAllCreatedContacts();
26 SugarTestAccountUtilities::removeAllCreatedAccounts();
27 SugarTestEmailUtilities::removeAllCreatedEmails();
28 SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
29 unset($GLOBALS['current_user']);
32 public function testContactRelationship()
34 $this->assertTrue($this->email->parent_type == 'Accounts', "The email parent_type should be Accounts");
35 $this->assertTrue($this->email->parent_id == $this->account->id, "The email parent_id should be SDizzle");
37 $this->email->fill_in_additional_detail_fields();
38 $this->assertTrue(empty($this->email->contact_id), "There should be no contact associated with the Email");